package participle.jar;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import com.hankcs.hanlp.HanLP;
import com.hankcs.hanlp.seg.common.Term;

public class Participle {
	private static Scanner input;

	/**
	 * @Title: getTermList
	 * @Description: 分词，在hanlp.properties文件中的root=/var/server/hanLP/改变本机中的HanLP的data上级目录
	 *               版本：hanlp-1.2.8.jar
	 * @param content
	 *            输入的内容
	 * @return
	 * @return List<Term>
	 * @author Alexis
	 */
	public static final List<Term> getTermList(String content) {
		List<Term> termList = new ArrayList<Term>();
		termList = HanLP.segment(content);
		return termList;
	}

	public static void main(String[] args) {
		System.out.println("请输入要分析的内容(输入exit结束循环):");
		input = new Scanner(System.in);
		while (true) {
			String content = input.nextLine();
			if (content.equals("exit")) {
				break;
			}
			List<Term> termList = Participle.getTermList(content);
			System.out.println(termList);
		}
	}
}
